inspector: Handle attribute mapping changes better
authorMatthias Clasen <mclasen@redhat.com>
Sat, 31 May 2014 01:47:40 +0000 (21:47 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 31 May 2014 01:56:07 +0000 (21:56 -0400)
When the mapping is changed, notify the property and
queue a draw on the widget. This makes both the inspector
and the app update their display.

gtk/inspector/prop-editor.c

index c90a1145a3d87e9dfb7dc181361d44d6b300348c..f81d002b61d2d8079954b1308d3c445429f50a44 100644 (file)
@@ -1073,6 +1073,17 @@ gtk_cell_layout_get_model (GtkCellLayout *layout)
     return NULL;
 }
 
+GtkWidget *
+gtk_cell_layout_get_widget (GtkCellLayout *layout)
+{
+  if (GTK_IS_TREE_VIEW_COLUMN (layout))
+    return gtk_tree_view_column_get_tree_view (GTK_TREE_VIEW_COLUMN (layout));
+  else if (GTK_IS_WIDGET (layout))
+    return GTK_WIDGET (layout);
+  else
+    return NULL;
+}
+
 static void
 model_properties (GtkButton              *button,
                   GtkInspectorPropEditor *editor)
@@ -1102,6 +1113,8 @@ attribute_mapping_changed (GtkComboBox            *combo,
       if (col != -1)
         gtk_cell_area_attribute_connect (area, cell, editor->priv->name, col);
       gtk_widget_set_sensitive (editor->priv->editor, col == -1);
+      notify_property (editor->priv->object, find_property (editor));
+      gtk_widget_queue_draw (gtk_cell_layout_get_widget (GTK_CELL_LAYOUT (layout)));
     }
 }